home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 1 / ETO Development Tools 1.iso / Essentials / C++ AppleLink Messages / CPlus.Dev$ 6⁄1⁄90 / 0135-C++ string initializ-May90 < prev    next >
Encoding:
Text File  |  1990-06-01  |  1.1 KB  |  41 lines  |  [TEXT/GEOL]

  1. Item forwarded  by  TIM.SWIHART  to GARDNER.P    CPLUS.BUGS
  2.  
  3. Item    1594913                         31-May-90        19:35PDT
  4.  
  5. From:   D6418                           Jeppson, John,PRT
  6.  
  7. To:     CPLUS.DEV$                      C++ Interest List--Developers
  8.         MACDTS                          Macintosh Developer Tech Supt
  9.  
  10. Sub:    C++ string initialization
  11.  
  12. Is this a bug in the C++ compiler?
  13.  
  14. If it's a feature then what am I supposed to use?  How, for example,
  15.     can I initialize a Str255 if I can't do:  Str255 s = "\pHumbug";
  16.  
  17.  ***********
  18.  
  19. MPW C successfully compiles the following code, which then runs as expected.
  20.  
  21. MPW C++ chokes on the initialization of "myOtherString". The compiler returns
  22.  
  23.     ### Error 217 L-value required
  24.  
  25.  *************
  26.  
  27.     #include <StdIO.h>
  28.  
  29.     typedef char stringType[30];
  30.  
  31.     int main( int argc, char* argv[] )               // "C++"
  32.  // int main( int argc, char *argv[], char *envp[] ) // "C"
  33.     {
  34.         char       myString[30]  = "Hello1";
  35.         stringType myOtherString = "Hello2";
  36.  
  37.         printf( "%s\n%s\n", myString, myOtherString );
  38.         return 0;
  39.     }
  40.  
  41.